from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP

# 私钥
with open("pri_key.pem", "rb") as file:
  pri_key_text = file.read()
  pri_key = RSA.import_key(pri_key_text)
  # 解密
  with open("../result/encrypt.certificate", "rb") as file:
    etext = file.read()
    cipher_de = PKCS1_OAEP.new(pri_key)
    dtext = cipher_de.decrypt(etext)
    print("解密：", dtext.decode("utf-8"))
